#include <stdio.h>
#include <stdlib.h>

void insert_sort(int a[], int n)
{
    for (int i = 1; i < n; i++)
    {
        int temp = a[i];
        int t = i;
        for (; t > 0 && temp < a[t - 1]; t--)
        {
            a[t] = a[t - 1];
        }
        a[t] = temp;
    }
}

int main()
{
    /*******************code*******************/
    int a[] = {4, 3, 10, 8, 14, 13, 7, 30, 26, 17};
    insert_sort(a, 10);
    printf("insert_sortw\n");
    for (int i = 0; i < 10; i++)
        printf("%3d", a[i]);
    printf("\n");
    /******************************************/
    printf("\n\n****************************\n");
    printf("Press Enter key to continue\n");
    getchar();
    return 0;
    /******************************************/
}
